/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package controller;

import java.sql.Date;
import vo.rb_product;
import vo.rb_product_raw_mat_asn;
import vo.rb_product_stock;

/**
 *
 * @author subin
 */
public class ProductController {
    public static ProductController getInstance() {
        
        return new ProductController();
    }
    
     public rb_product create(rb_product product){
        
        return null;
    }
    
    public rb_product update(rb_product product){
        
        return null;
    }
    
    public rb_product[] fetchAll(){
        
        return null;
    }
    
    public String delete(rb_product product){
        
        return null;
    }
    
    public rb_product fetch(String productId){
        
        return null;
    }
     
    public rb_product_stock fetchStock(String productId){
         
         return null;
     }
     
     public rb_product_stock updateStock(String productId,int quantity,Date date){
         rb_product_stock currentStock = fetchStock(productId);
         rb_product_stock updatedStock = new rb_product_stock();

         if(currentStock != null){
            updatedStock.setCurrent_stock(currentStock.getCurrent_stock()+quantity);
         }
         else{
             updatedStock.setCurrent_stock(quantity);
         }
         
         updatedStock.setProduct_id(productId);
         updatedStock.setLast_updated_date(date);
         
         
         
         return null;
         
     }
     
     public rb_product_raw_mat_asn[] fetchAssociatedRawMaterials(String productId){
         
         return null;
     }
}
